//
//  SongTableViewCell.m
//  Coco_Music
//
//  Created by dlios on 15-6-25.
//  Copyright (c) 2015年 寇广超. All rights reserved.
//

#import "SongTableViewCell.h"

@implementation SongTableViewCell
-(void)dealloc
{
    [_mySingle release];
    [_nameLabel release];
    [_numberLabel release];
    [_singerNameLabel release];
    [super dealloc];
    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self= [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.numberLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.frame.origin.x+5, self.frame.origin.y+5, [UIScreen mainScreen].bounds.size.width/6,[ UIScreen mainScreen].bounds.size.width/6)];
    [self addSubview:self.numberLabel];
    [_numberLabel release];
    
    self.nameLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.numberLabel.frame.origin.x+60, self.numberLabel.frame.origin.y, 200, 30)];
    self.nameLabel.font =[UIFont systemFontOfSize:18];
    [self addSubview:self.nameLabel];
    [_nameLabel release];
    
    self.singerNameLabel =[[UILabel alloc]initWithFrame:CGRectMake(self.nameLabel.frame.origin.x, self.nameLabel.frame.origin.y+self.nameLabel.frame.size.height, 200, 30)];
    self.singerNameLabel.font =[UIFont systemFontOfSize:13];
    [self addSubview:self.singerNameLabel];
    [_singerNameLabel release];
    
    UIImageView *ImageV =[[UIImageView alloc]initWithFrame:CGRectMake(self.numberLabel.frame.origin.x+20, self.singerNameLabel.frame.size.height+self.singerNameLabel.frame.origin.y, [UIScreen mainScreen].bounds.size.width-self.numberLabel.frame.origin.x*2-40 ,2)];
    ImageV.backgroundColor =[UIColor lightGrayColor];
    [self addSubview:ImageV];
    [ImageV release];
    
}
-(void)setMySingle:(single *)mySingle
{
    if (_mySingle  !=mySingle) {
        [_mySingle release];
        _mySingle =[mySingle retain];
        
    } 
    self.nameLabel.text = mySingle.song_name;
    self.singerNameLabel.text = [NSString stringWithFormat:@"%@ ",mySingle.singer_name];
   
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
